package com.sgb.kjwl.view.ui.adapter.self.publish;

import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.StrengthEntity;
import com.sgb.kjwl.model.entity.user.AttrEntity;
import com.swgk.core.customview.DecimalInputTextWatcher;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class StrengthGradeAdapter extends BaseRecycleAdapter<StrengthEntity> {

    private TextView tv_line;
    private EditText editText;

    public StrengthGradeAdapter(Context context, List<StrengthEntity> datas) {
        super(context, R.layout.item_strength_grade, datas);
    }

    @Override
    public void convert(ItemViewHolder holder, final StrengthEntity entity) {
        holder.setBinding(BR.viewModel, entity);
        tv_line = holder.itemView.findViewById(R.id.tv_line);
        editText = holder.itemView.findViewById(R.id.et_price);
        if (holder.getPosition() == datas.size() - 1)
            tv_line.setVisibility(View.GONE);
//        editText.setFilters(new InputFilter[]{new InputFilterMinMax("0.00", "9999.99")});
        editText.addTextChangedListener(new DecimalInputTextWatcher(editText,4,2));
    }
}
